/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vodjaho.lab;

/**
 *
 * @author Maxim A. Kanev <ask.me.makes@gmail.com> [mkanev]
 */
public class User {

    private String login;
    private String password;
    private String fullname;

    public User(String login, String password, String fullname) {
        this.login = login;
        this.password = password;
        this.fullname = fullname;
    }

    public User() {
        login = "default";
        password = "default";
        fullname = "Default User";
    }

    public void parseString(String line) {
        String[] params = line.split(";");
        if (params.length == 3) {
            setLogin(params[0]);
            setPassword(params[1]);
            setFullname(params[2]);
        }
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final User other = (User) obj;
        if ((this.login == null) ? (other.login != null) : !this.login.equals(other.login)) {
            return false;
        }
        if ((this.password == null) ? (other.password != null) : !this.password.equals(other.password)) {
            return false;
        }
        if ((this.fullname == null) ? (other.fullname != null) : !this.fullname.equals(other.fullname)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 89 * hash + (this.login != null ? this.login.hashCode() : 0);
        hash = 89 * hash + (this.password != null ? this.password.hashCode() : 0);
        hash = 89 * hash + (this.fullname != null ? this.fullname.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "User{" + "login=" + login + "password=" + password + "fullname=" + fullname + '}';
    }
}
